package br.net.woodstock.tickettoride.orm;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@Entity
@Table(name = "ttr_user")
public class User extends AbstractIntegerEntity {

	private static final long	serialVersionUID	= 8649892090785869894L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "user_id", unique = true)
	private Integer				id;

	@Column(name = "user_login", length = 45, nullable = false)
	@NotNull
	@Size(min = 1, max = 45)
	private String				login;

	@Column(name = "user_name", length = 100, nullable = false)
	@NotNull
	@Size(min = 1, max = 100)
	private String				name;

	@Column(name = "user_email", length = 100, nullable = false)
	@NotNull
	@Size(min = 1, max = 100)
	private String				email;

	@Column(name = "user_password", length = 255, nullable = false)
	@NotNull
	@Size(min = 1, max = 255)
	private String				password;

	@Column(name = "user_salt", length = 20, nullable = false)
	@NotNull
	@Size(min = 1, max = 20)
	private String				salt;

	@Column(name = "user_status", nullable = false)
	@Enumerated(EnumType.ORDINAL)
	@NotNull
	private UserStatus			status;

	@Column(name = "user_type", nullable = false)
	@Enumerated(EnumType.ORDINAL)
	@NotNull
	private UserType			type;

	public User() {
		super();
	}

	public User(final Integer id) {
		super();
		this.id = id;
	}

	@Override
	public Integer getId() {
		return this.id;
	}

	@Override
	public void setId(final Integer id) {
		this.id = id;
	}

	public String getLogin() {
		return this.login;
	}

	public void setLogin(final String login) {
		this.login = login;
	}

	public String getName() {
		return this.name;
	}

	public void setName(final String name) {
		this.name = name;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(final String email) {
		this.email = email;
	}

	public String getPassword() {
		return this.password;
	}

	public void setPassword(final String password) {
		this.password = password;
	}

	public String getSalt() {
		return this.salt;
	}

	public void setSalt(final String salt) {
		this.salt = salt;
	}

	public UserStatus getStatus() {
		return this.status;
	}

	public void setStatus(final UserStatus status) {
		this.status = status;
	}

	public UserType getType() {
		return this.type;
	}

	public void setType(final UserType type) {
		this.type = type;
	}

}
